package cn.buk.tms.dto;

import cn.buk.tms.entity.misc.Customer;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 客户信息DTO
 * @author yfdai
 */
public class CustomerDetailDto {

    public static CustomerDetailDto createByCustomer(Customer c) {
        CustomerDetailDto dto = new CustomerDetailDto();
        BeanUtils.copyProperties(c, dto);

        dto.setGroupCode(c.getCustomerServiceGroupCode());

        return dto;
    }

    private int id;

    /**
     * >0 表示客户所对应的企业id
     */
    private int customerEnterpriseId;

    /**
     * 企业名称
     */
    private String vipName;

    /**
     * 企业全称
     */
    private String fullName;

    /**
     * 客户编号(用户自定义，用于显示）
     */
    private String customerCode;

    private String pinyin;

    /**
     * 服务项目
     */
    private String serviceItem;

    /**
     * 销售员
     */
    private String salesStaff;

    /**
     * 客户维护人
     */
    private String customerMaintainer;

    private int settlementType;
    /**
     * 结算方式
     */
    private String settlementMode;

    /**
     * 结算周期
     */
    private String settlementPeriod;

    /**
     * 协议开始日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date agreementBeginDate;

    /**
     * 协议结束日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date agreementEndDate;

    /**
     * 与t101中的username相同, 冗余
     */
    private String username;

    /**
     * 合同联系人
     */
    private String contractLinkman;

    /**
     * 合同联系人的联系电话
     */
    private String contractLinkPhone;

    /**
     * 企业差旅负责人（审核人）(账单）
     */
    private String linkman;

    /**
     * 联系电话
     */
    private String phone;

    private String email;

    private String mobile;

    private String fax;

    /**
     * 邮编
     */
    private String postCode;

    /**
     * 账单邮寄地址
     */
    private String address;


    /**
     * 备注
     */
    private String remark;

    /**
     * 是否需要审批出票
     * 0-不需要
     * 1-需要
     */
    private Integer approvalTicket;

    private int approvalType;

    /**
     * 审核方式
     */
    private String approvalMode;

    /**
     * 行程单需求
     */
    private int itineraryType;

    private int enterpriseType;

    /**
     * 是否采取测试模式
     * 0 - 否
     * 1 - 是
     */
    private int testMode;

    /**
     * 客户服务分组代码
     **/
    private String groupCode;
    /**
     * 客户服务分组名称
     */
    private String groupName;

    /**
     * 适用的服务费模板的代码
     */
    private String templateCode;

    /**
     * 适用的服务费模板的名称
     */
    private String templateName;

    /**
     * 结算单报表模板id
     */
    private int reportTemplateId;

    /**
     * 结算单报表模板名称
     */
    private String reportTemplateName;


    /**
     * 短信发送模式
     */
    private int smsMode;

    /**
     * 状态
     */
    private int status;

    /**
     * 该客户的登录信息
     */
    private LoginInfoDto loginInfo;

    /**
     * 邮寄地址
     */
    private List<AddressDto> addresses;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date recency;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lastUpdate;

    public Date getLastUpdate() {
        return lastUpdate;
    }

    public void setLastUpdate(Date lastUpdate) {
        this.lastUpdate = lastUpdate;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getApprovalMode() {
        return approvalMode;
    }

    public void setApprovalMode(String approvalMode) {
        this.approvalMode = approvalMode;
    }

    public Integer getApprovalTicket() {
        return approvalTicket;
    }

    public void setApprovalTicket(Integer approvalTicket) {
        this.approvalTicket = approvalTicket;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getVipName() {
        return vipName;
    }

    public void setVipName(String vipName) {
        this.vipName = vipName;
    }

    public String getFullName() {
        return fullName;
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    public String getCustomerCode() {
        return customerCode;
    }

    public void setCustomerCode(String customerCode) {
        this.customerCode = customerCode;
    }

    public String getServiceItem() {
        return serviceItem;
    }

    public void setServiceItem(String serviceItem) {
        this.serviceItem = serviceItem;
    }

    public String getSalesStaff() {
        return salesStaff;
    }

    public void setSalesStaff(String salesStaff) {
        this.salesStaff = salesStaff;
    }

    public String getCustomerMaintainer() {
        return customerMaintainer;
    }

    public void setCustomerMaintainer(String customerMaintainer) {
        this.customerMaintainer = customerMaintainer;
    }

    public String getSettlementMode() {
        return settlementMode;
    }

    public void setSettlementMode(String settlementMode) {
        this.settlementMode = settlementMode;
    }

    public String getSettlementPeriod() {
        return settlementPeriod;
    }

    public void setSettlementPeriod(String settlementPeriod) {
        this.settlementPeriod = settlementPeriod;
    }

    public Date getAgreementBeginDate() {
        return agreementBeginDate;
    }

    public void setAgreementBeginDate(Date agreementBeginDate) {
        this.agreementBeginDate = agreementBeginDate;
    }

    public Date getAgreementEndDate() {
        return agreementEndDate;
    }

    public void setAgreementEndDate(Date agreementEndDate) {
        this.agreementEndDate = agreementEndDate;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getContractLinkman() {
        return contractLinkman;
    }

    public void setContractLinkman(String contractLinkman) {
        this.contractLinkman = contractLinkman;
    }

    public String getContractLinkPhone() {
        return contractLinkPhone;
    }

    public void setContractLinkPhone(String contractLinkPhone) {
        this.contractLinkPhone = contractLinkPhone;
    }

    public String getLinkman() {
        return linkman;
    }

    public void setLinkman(String linkman) {
        this.linkman = linkman;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getFax() {
        return fax;
    }

    public void setFax(String fax) {
        this.fax = fax;
    }

    public String getPostCode() {
        return postCode;
    }

    public void setPostCode(String postCode) {
        this.postCode = postCode;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public int getSettlementType() {
        return settlementType;
    }

    public void setSettlementType(int settlementType) {
        this.settlementType = settlementType;
    }

    public int getApprovalType() {
        return approvalType;
    }

    public void setApprovalType(int approvalType) {
        this.approvalType = approvalType;
    }

    public int getItineraryType() {
        return itineraryType;
    }

    public void setItineraryType(int itineraryType) {
        this.itineraryType = itineraryType;
    }

    public String getPinyin() {
        return pinyin;
    }

    public void setPinyin(String pinyin) {
        this.pinyin = pinyin;
    }

    public int getEnterpriseType() {
        return enterpriseType;
    }

    public void setEnterpriseType(int enterpriseType) {
        this.enterpriseType = enterpriseType;
    }

    public int getCustomerEnterpriseId() {
        return customerEnterpriseId;
    }

    public void setCustomerEnterpriseId(int customerEnterpriseId) {
        this.customerEnterpriseId = customerEnterpriseId;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public LoginInfoDto getLoginInfo() {
        return loginInfo;
    }

    public void setLoginInfo(LoginInfoDto loginInfo) {
        this.loginInfo = loginInfo;
    }

    public Date getRecency() {
        return recency;
    }

    public void setRecency(Date recency) {
        this.recency = recency;
    }

    public String getGroupCode() {
        return groupCode;
    }

    public void setGroupCode(String groupCode) {
        this.groupCode = groupCode;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public int getSmsMode() {
        return smsMode;
    }

    public void setSmsMode(int smsMode) {
        this.smsMode = smsMode;
    }

    public List<AddressDto> getAddresses() {
        if (addresses == null) {
            addresses = new ArrayList<>();
        }
        return addresses;
    }

    public void setAddresses(List<AddressDto> addresses) {
        this.addresses = addresses;
    }

    public String getTemplateCode() {
        return templateCode;
    }

    public void setTemplateCode(String templateCode) {
        this.templateCode = templateCode;
    }

    public String getTemplateName() {
        return templateName;
    }

    public void setTemplateName(String templateName) {
        this.templateName = templateName;
    }

    public int getReportTemplateId() {
        return reportTemplateId;
    }

    public void setReportTemplateId(int reportTemplateId) {
        this.reportTemplateId = reportTemplateId;
    }

    public String getReportTemplateName() {
        return reportTemplateName;
    }

    public void setReportTemplateName(String reportTemplateName) {
        this.reportTemplateName = reportTemplateName;
    }

    public int getTestMode() {
        return testMode;
    }

    public void setTestMode(int testMode) {
        this.testMode = testMode;
    }
}
